package com.panshi.service.impl;

import com.panshi.mapper.CollectionMapper;
import com.panshi.service.CollectionService;
import com.panshi.vo.CollectionVO;
import com.panshi.vo.PageSizeVO;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestBody;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CollectionServiceImpl implements CollectionService {

    @Resource
    private CollectionMapper collectionMapper;

    @Override
    //@Cacheable(value = "personalcol",key = "#root.methodName+#pageSizeVO.startIndex")
    public List<CollectionVO> findCoQuery(@RequestBody PageSizeVO pageSizeVO) {
        pageSizeVO.setStartIndex(pageSizeVO.getStartIndexInfo());
        return collectionMapper.findCoQuery(pageSizeVO);
    }

    @Override
   // @CacheEvict(value="personalcol",allEntries=true)
    public void deleteCo(int cid) {
        collectionMapper.deleteCo(cid);
    }

    @Override
    public Integer querycollectioncount(int uid) {
        return collectionMapper.querycollectioncount(uid);
    }
}
